﻿using System;
using System.Windows.Forms;

namespace Borg.Framework
{
    public class PlugTypeButton : Button, IAttachable
    {
        public PlugTypeButton(PlugTypeInfo plugType)
        {
            PlugType = plugType;
        }

        public void Attach(SlotInfo slot)
        {
            Action = new PlugAction(slot, PlugType);
        }

        public void Detach()
        {
            Action = null;
        }

        protected override void OnClick(EventArgs e)
        {
            Action.Do(this, e);
            base.OnClick(e);
        }

        public PlugAction Action { get; private set; }

        public PlugTypeInfo PlugType { get; private set; }
    }
}

